<?php

namespace App\Http;

use App\Middleware\AllowCrossDomain;
use App\Middleware\CheckSignature;
use App\Middleware\CheckToken;
use App\Middleware\ParamsHandler;
use App\Middleware\RequestLog;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode;
use Illuminate\Http\Middleware\SetCacheHeaders;
use Illuminate\Routing\Middleware\ThrottleRequests;

class Kernel extends HttpKernel
{
    /**
     * The application's global HTTP middleware stack.
     *
     * These middleware are run during every request to your application.
     *
     * @var array
     */
    protected $middleware = [
        CheckForMaintenanceMode::class,
//        AllowCrossDomain::class,
        ParamsHandler::class,
        RequestLog::class,
        CheckSignature::class,
    ];

    /**
     * The application's route middleware groups.
     *
     * @var array
     */
    protected $middlewareGroups = [
        'api' => [
            'check_token',
        ],
    ];

    /**
     * The application's route middleware.
     *
     * These middleware may be assigned to groups or used individually.
     *
     * @var array
     */
    protected $routeMiddleware = [
        'cache.headers' => SetCacheHeaders::class,
        'throttle' => ThrottleRequests::class,
        'check_token' => CheckToken::class,
    ];

    /**
     * The priority-sorted list of middleware.
     *
     * This forces non-global middleware to always be in the given order.
     *
     * @var array
     */
    protected $middlewarePriority = [
        ThrottleRequests::class,
        CheckToken::class,
    ];
}
